﻿#ifndef SHOWFRAMEOPENGLWIDGET_H
#define SHOWFRAMEOPENGLWIDGET_H

#include <QApplication>
#include <QOpenGLWidget>
#include <QOpenGLFunctions_4_5_Core>
#include <QTimer>
#include <iostream>
#include <QImage>
#include <QImageReader>
#include <QOpenGLShaderProgram>
#include <iostream>
#include <fstream>
#include <QOpenGLTexture>
#include "Global.h"
class ShowFrameOpenGLWidget:public QOpenGLWidget, public QOpenGLFunctions_4_5_Core
{
    Q_OBJECT
public:
    ShowFrameOpenGLWidget(QWidget* parent);
protected:
    void initializeGL() override;
    void paintGL() override;

public:
    void creatVertex();
    void creatTexture();
    void creatProgram();
public:
    void beginUpdateFrame();
    void updateFrame();
    void endUpdateFrame();
    void genuv(uchar *uv, uchar *newuv);
 public:
    bool status;//是否开启远程
    QTimer* timer;
    unsigned int VAO,VBO;
    int w,h;
    int frameRate;
    QOpenGLShaderProgram program;
    QOpenGLTexture* yText;
    QOpenGLTexture* uText;
    QOpenGLTexture* vText;
    uchar* y;
    uchar* u;
    uchar* v;
};

#endif // SHOWFRAMEOPENGLWIDGET_H
